using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace CPGVertragsverwaltung.ErrorHandling
{
    public class MessageHandling
    {

        public static void showError(String pErrorText)
        {
            MessageBox.Show(pErrorText, "CPG Vertragsverwaltung - Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }

        public static void showInformation(String pInfoText)
        {
            MessageBox.Show(pInfoText, "CPG Vertragsverwaltung - Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            
        }

        public static DialogResult promptUser(String pPromptText)
        {
            return MessageBox.Show(pPromptText, "CPG Vertragsverwaltung - Abfrage", MessageBoxButtons.YesNo, MessageBoxIcon.Question); 
        }

        public static void stopppingHand(String pText)
        {
            MessageBox.Show(pText, "CPG Vertragsverwaltung - Warnung", MessageBoxButtons.OK, MessageBoxIcon.Hand);
        }

        //Write To EventLog
        public static void showError(String pErrorText, bool pWriteEventLog)
        {
            MessageBox.Show(pErrorText, "CPG Vertragsverwaltung - Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
            if (pWriteEventLog)
            {
                EventLogger myLogger = new EventLogger();
                myLogger.addError(pErrorText);
            }
        }

        public static void showInformation(String pInfoText, bool pWriteEventLog)
        {
            MessageBox.Show(pInfoText, "CPG Vertragsverwaltung - Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            if (pWriteEventLog)
            {
                EventLogger myLogger = new EventLogger();
                myLogger.addInformation(pInfoText);
            }
        }

        public static void stopppingHand(String pText, bool pWriteEventLog)
        {
            MessageBox.Show(pText, "CPG Vertragsverwaltung - Warnung", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            if (pWriteEventLog)
            {
                EventLogger myLogger = new EventLogger();
                myLogger.addWarning(pText);
            }
        }
    }
}
